﻿using UnityEngine;
using System.Collections.Generic;
namespace Room
{
    public class RCAIOtherPlayer : RCAIActor
    {
        public float lastTime;
        public int killNum;

        public RCAIOtherPlayer(RoomCharactor owner)
            :base(owner)
        {
            type = AIType.OtherPlayer;
        }
        public override void SetKillNum(int killNum)
        {
            this.killNum = killNum;
            var data = Dict.Blo.DictKillerBlo.GetKillerData(killNum);
            owner.ui.SetColor(new Color(data.colorR / 255f, data.colorG / 255f, data.colorB / 255f));
        }
        public override int GetKillNum()
        {
            return killNum;
        }

        public override void Tick()
        {
            base.Tick();

            if(Time.time-lastTime>1f)
            {
                lastTime = Time.time;
            }

            if (owner.IsMoving())
            {
                var ai = owner.ai as RCAIActor;
                if (ai.curState == PlayerAIState.Normal)
                {
                    owner.PlayAnim("run");
                }
            }
            else
            {
                var ai = owner.ai as RCAIActor;
                if (ai.curState == PlayerAIState.Normal)
                {
                    owner.PlayAnim("stand");
                }
                
            }
        }
    }
}

